﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CPPEI.Coolzon.Designer.Views
{
    /// <summary>
    /// ViewHistoryWindow.xaml 的交互逻辑
    /// </summary>
    public partial class ViewHistoryWindow : Window
    {
        public ViewHistoryWindow()
        {
            InitializeComponent();

            this.Loaded += ViewHistoryWindow_Loaded;
            this.Closing += ViewHistoryWindow_Closing;
        }

        void ViewHistoryWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Event.NCL.NCLEventBus.Unregister(this);
        }

        void ViewHistoryWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Event.NCL.NCLEventBus.Register(this);
            Guid itemId = Guid.Empty;
            if (UIContext.Current.CurrentSelectedNode.NodeType == NodeType.Template)
            {
                itemId = UIContext.Current.CurrentSelectedNode.ParentID;
            }
            else
            {
                itemId = UIContext.Current.CurrentSelectedNode.ID;
            }
            Event.NCL.NCLEventBus.Publish(new Event.NCL.BeginGetItemHistoryListEvent(itemId));
        }
    }
}
